<template>
    <div>
        <a-row :gutter="20">
            <a-col :md="12" :span="24">
                <a-card>
                    <strong>站点信息</strong>
                    <br/>
                    网站名称：静心尽力写生活
                    <br/>
                    现任班级：{{siteClass}} 班
                    <br/>
                    管理员数：{{adminNum}}
                </a-card>
            </a-col>
            <a-col :md="12" :span="24">
                <a-card>
                    <a-row :gutter="20">
                        <a-col :md="12" :span="24">
                            <a-statistic title="总文章数" :value="atcNum"/>
                        </a-col>
                        <a-col :md="12" :span="24">
                            <a-statistic title="总用户数" :value="userNum"/>
                        </a-col>
                    </a-row>
                    <br/>
                </a-card>
            </a-col>
        </a-row>

        <a-row :gutter="20">
            <a-col :md="12" :span="24">
                <br/>
                <a-card>
                    <a-row :gutter="20">
                        <a-col :md="12" :span="24">
                            <a-statistic title="全站阅读量" :value="info.views"/>
                        </a-col>
                        <a-col :md="12" :span="24">
                            <a-statistic title="全站点赞量" :value="info.likes"/>
                        </a-col>
                    </a-row>
                    <br/>
                </a-card>
            </a-col>
            <a-col :md="12" :span="24">
                <br/>
                <a-card>
                    敬请期待...
                </a-card>
            </a-col>
        </a-row>
        <br/>
        <br/>
    </div>
</template>

<script>
    export default {
        name: "Info",
        data(){
            return{
                // siteName: '',
                siteClass: '',
                adminNum: 0,
                atcNum: 0,
                userNum: 0,
                info: '',
            }
        },
        created() {
            this.getData();
        },methods:{
            getData(){
                const t = this;
                axios.get('/conf/get/class').then(function (resp) {
                    t.siteClass = resp.data;
                })
                axios.get('/admin/getAllAdmins').then(function (resp) {
                    t.adminNum = resp.data.length;
                })
                axios.get('/admin/getAllUsers').then(function (resp) {
                    t.userNum = resp.data.length;
                })
                axios.get('/atc/getAll').then(function (resp) {
                    t.atcNum = resp.data.length;
                })
                axios.get('/atc/getTot').then(function (resp) {
                    t.info = resp.data;
                })
            }
        }
    }
</script>

<style scoped>

</style>